Method LockForUpdateAsync(params long[])
Acquire row-level locks on objects by id within the current transaction and report how
many of the requested rows exist (and are therefore locked). A deleted or never-created
id locks nothing and is NOT an error here - the returned count is the signal; compare it
with your distinct id set (BR-9, 2026-09-02: a silent no-op lock plus the default
MissingObjectStrategy.AutoSwitchToInsert let a CAS save resurrect a deleted object).
Must be called inside an active transaction (IRedbContext.BeginTransactionAsync
or IRedbContext.ExecuteAtomicAsync(Func<Task>)): locks release when the
transaction ends. Rows are locked in ascending id order, so concurrent lockers do not
deadlock on each other. PostgreSQL: SELECT ... FOR UPDATE. MSSQL: WITH (UPDLOCK, ROWLOCK).
SQLite: an existence check only - writers are serialized database-wide.
public Task<int> LockForUpdateAsync(params long[] objectIds)